<template>
    <div :style="StyleDiv">
        <h2>我是子组件</h2>
        <p>祖先组件传来的值</p>
    </div>

</template>
<script setup>
import { inject,computed } from 'vue';


const theme=inject('tKey',{
    color:'red',
    fontSize:'20px'
})

const StyleDiv=computed(()=>({
        color: theme.color,
        fontSize:theme.fontSize
    }))

</script>